const tianditu_Token = "12b4a8041009d83ced0ee62a90bc940a";
// 服务域名
const tdtUrl = "https://t{s}.tianditu.gov.cn";
// 服务负载子域
const subdomains = ["0", "1", "2", "3", "4", "5", "6", "7"];

//加载天地图 - 影像 - 墨卡托投影
export const tdt_load_yx = () => {
  let imageryProvider = new Cesium.WebMapTileServiceImageryProvider({
    url:
      tdtUrl +
      "/img_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=img&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles&tk=" +
      tianditu_Token,
    layer: "tdtBasicLayer",
    style: "default",
    format: "image/jpeg",
    tileMatrixSetID: "GoogleMapsCompatible",
    subdomains: subdomains,
  });

  return imageryProvider;
};

export const tdt_contrayBorder = () => {
  // // 叠加国界服务
  return new Cesium.UrlTemplateImageryProvider({
    url: tdtUrl + "/DataServer?T=ibo_w&x={x}&y={y}&l={z}&tk=" + tianditu_Token,
    subdomains: subdomains,
    tilingScheme: new Cesium.WebMercatorTilingScheme(),
    maximumLevel: 10,
  });
};

//加载天地图 - 矢量 - 墨卡托投影
export const tdt_load_sl = () => {
  let imageryProvider = new Cesium.WebMapTileServiceImageryProvider({
    url:
      tdtUrl +
      "/vec_w/wmts?service=wmts&request=GetTile&version=1.0.0&LAYER=vec&tileMatrixSet=w&TileMatrix={TileMatrix}&TileRow={TileRow}&TileCol={TileCol}&style=default&format=tiles&tk=" +
      tianditu_Token,
    layer: "tdtBasicLayer",
    style: "default",
    format: "image/jpeg",
    tileMatrixSetID: "GoogleMapsCompatible",
    subdomains: subdomains,
  });

  return imageryProvider;
};

//加载天地图 - 影像注记 - 墨卡托投影
export const tdt_load_yx_zj = () => {
  //天地图标注
  let tiandiCva = new Cesium.UrlTemplateImageryProvider({
    subdomains: subdomains,
    url: tdtUrl + "/DataServer?T=cia_w&x={x}&y={y}&l={z}&tk=" + tianditu_Token,
  });

  return tiandiCva;
};

//加载天地图 - 矢量注记 - 墨卡托投影
export const tdt_load_sl_zj = () => {
  //天地图标注
  let tiandiCva = new Cesium.UrlTemplateImageryProvider({
    subdomains: subdomains,
    url: tdtUrl + "/DataServer?T=cva_w&x={x}&y={y}&l={z}&tk=" + tianditu_Token,
  });

  return tiandiCva;
};
